from django.db import models

# Create your models here.

# A4作业
# class Movie(models.Model):
#     name = models.CharField(max_length=100)
#     pic = models.ImageField(default="")
#     create_time = models.CharField(max_length=100)
#     class Meta:
#         db_table='movie'
#
# class Actor(models.Model):
#     name = models.CharField(max_length=100)
#     age = models.IntegerField()
#     gender = models.CharField(max_length=20)
#     movie=models.ForeignKey(Movie,on_delete=models.CASCADE)
#     class Meta:
#         db_table='actor'
#
#
# # A1作业
# class Teacher(models.Model):
#     username=models.CharField(max_length=100)
#     password=models.CharField(max_length=2000)
#     class Meta:
#         db_table='teacher'
#
# class Student(models.Model):
#     name = models.CharField(max_length=100)
#     age = models.IntegerField()
#     teacher = models.ForeignKey(Teacher,on_delete=models.CASCADE)
#     class Meta:
#         db_table='student'




class Sclass(models.Model):
    name = models.CharField(max_length=30)
    class Meta:
        db_table='sclass'

class Course(models.Model):
    name = models.CharField(max_length=30)
    cla = models.ForeignKey(Sclass,on_delete=models.CASCADE,related_name="course")
    class Meta:
        db_table='course'

class Stu(models.Model):
    name = models.CharField(max_length=30,unique=True)
    username = models.CharField(max_length=30)
    password = models.CharField(max_length=50)
    cla = models.ForeignKey(Sclass,on_delete=models.CASCADE)
    class Meta:
        db_table='stu'
